#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main()
{
    int fd=open("myfifo",O_RDONLY);
    if(fd==-1)
    {
        perror("open failed");
        exit(EXIT_FAILURE);
    }

    char buf[1024];
    ssize_t ret=read(fd,buf,sizeof(buf));
    if(ret>0)
    {
        write(STDOUT_FILENO,buf,ret);
    }
    else if(ret==0)
    {
        printf("EOF\n");
    }
    else
    {
        perror("read failed");
        exit(EXIT_FAILURE);
    }
    close(fd);
    return 0;
}